export default new (class {
  width: number = 0;
  height: number = 0;
  itemHeight: number = 0;
  itemWidth: number = 0;
  imageList: ImageData[][] = [];
  rowDatas: ArrayBuffer[][] = [];
  getPxData(x: number, y: number) {
    const colIndex = Math.floor(x / this.itemWidth);
    const colPosition = x - colIndex * this.itemWidth;
    const rowIndex = Math.floor(y / this.itemHeight);
    const rowPosition = y - rowIndex * this.itemHeight;
    if (this.rowDatas[rowPosition][colPosition]) {
      const dataView = new DataView(this.rowDatas[rowPosition][colPosition]);
      return dataView.getUint8(rowPosition * this.itemWidth + colPosition);
    }
  }
})();
